package operation;
import book.BooList;
import book.Book;

import java.util.Scanner;

public class FindBook implements IOperation{
    @Override
    public void work(BooList booList) {
        System.out.println("查找图书...");
        Scanner sca = new Scanner(System.in);
        String name = sca.nextLine();
        ////1.先确定  当前数组当中 有效的书籍个数
        int currentSize = booList.getUsedSize();
        for (int i = 0; i < currentSize; i++) {
          Book book = booList.getBook(i);
            if(book.getTitle().equals(name)) {
                System.out.println("找到这本书籍了，书籍内容如下：");
                System.out.println(book);
                return;
            }
        }
        System.out.println("没有你要找的书籍。");
    }
}
